import type {
  BusChangeLogForm,
  BusChangeLogQuery,
  BusChangeLogVO,
} from './model';

import type { PageResult } from '#/api/common';

import { requestClient } from '#/api/request';

/**
 * 分页查询巴士变更日志列表
 * @param params
 * @returns 巴士变更日志列表
 */
export function changeLogPage(params?: BusChangeLogQuery) {
  return requestClient.get<PageResult<BusChangeLogVO>>('/bus/change/log/page', {
    params,
  });
}

/**
 * 查询未读变更日志数量
 * @param params
 * @returns 未读数
 */
export function changeLogUnReadCount(params?: BusChangeLogQuery) {
  return requestClient.get<number>('/bus/change/log/unreadCount', {
    params,
  });
}

/**
 * 更新巴士变更日志
 * @param data
 * @returns void
 */
export function changeLogUpdate(data: BusChangeLogForm) {
  return requestClient.putWithMsg<void>('/bus/changeLog', data);
}

/**
 * 修改日志为已读
 * @param data
 * @returns void
 */
export function changeLogSetReadStatus(data: BusChangeLogForm) {
  return requestClient.putWithMsg<void>(
    `/bus/change/log/changeReadStatus`,
    data,
  );
}
